package com.ys.ffms.controller;

import com.ys.ffms.common.Result;
import com.ys.ffms.pojo.Bill;
import com.ys.ffms.pojo.PO.ReportPO;
import com.ys.ffms.pojo.VO.queryBillVO;
import com.ys.ffms.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description: 图表数据控制层
 * @PROJECT_NAME: ffmsService
 * @DESCRIPTION:
 * @USER: lin
 * @DATE: 2022/1/17 13:11
 */
@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;


    /**
     * 查询饼图数据 支出
     * @return
     */
    @GetMapping("/findAllSpendingData")
    public Result<?> findAllSpendingData(){
        List<ReportPO> list = reportService.findAllSpendingData();
        return Result.success(list);
    }

    /**
     * 查询支出折线图 支出
     * @return
     */
    @GetMapping("/findDateByLine")
    public Result<?> findDateByLine(){
        List<Bill> list = reportService.findDateByLine();
        return Result.success(list);
    }

    /**
     * 查询饼图数据 收入
     * @return
     */
    @GetMapping("/findAllIncomeData")
    public Result<?> findAllIncomeData(){
        List<ReportPO> list = reportService.findAllIncomeData();
        return Result.success(list);
    }

    /**
     * 查询收入折线图
     * @return
     */
    @GetMapping("/findIncomeDateByLine")
    public Result<?> findIncomeDateByLine(){
        List<Bill> list = reportService.findIncomeDateByLine();
        return Result.success(list);
    }

    /**
     * 一周内消费总额前五数据 柱图
     * @return
     */
    @GetMapping("/expenditureColumnChart")
    public Result<?> expenditureColumnChart(){
       List<queryBillVO> list = reportService.expenditureColumnChart();
       return Result.success(list);
    }

    /**
     * 一周内收入总额前五数据 柱图
     * @return
     */
    @GetMapping("/incomeColumnChart")
    public Result<?> incomeColumnChart(){
        List<queryBillVO> list = reportService.incomeColumnChart();
        return Result.success(list);
    }
}
